<?php
require_once '../phpdocx/classes/CreateDocx.inc';

$objDocx = new CreateDocx();

//This line define the Table of Contents for the document
$objDocx->addTableContents('Arial');

//You need to add titles to populate the TOC
$paramsTitle = array(
    'val' => 1,
    'u' => 'single',
    'font' => 'Blackadder ITC',
    'sz' => 22
);

$docx->addTitle('Lorem ipsum dolor sit amet.', $paramsTitle);

//Remember to Refresh the TOC when you open de docx document with your word processor
$objDocx->createDocx('example_tablecontents');
?>